#! /usr/bin/python

def main():
  # Open the file, read it into memory as a single string.
  with open('alice_in_wonderland.txt') as alice_file:
    alice_text = alice_file.read()

  #print 'Unique words:', GetUniqueWords(alice_text)
  print 'Top Ten Words:', TopTenWords(GetUniqueWords(alice_text))


def GetUniqueWords(text): 
    words_dict = {} 
    text = text.split()
    for w in text:
        if w in words_dict:
            words_dict[w] += 1
        else:
           words_dict[w] = 1
    return words_dict
 
def TopTenWords(words_dict):
    top_ten = [] 
    words_list = words_dict.items()
    for n in range(10):
        top_ten.append(words_list[n])
    for t in words_list:
        for i in range(10):
            temp = top_ten[i-1]
            if t[1] > temp[1]:
                top_ten[i-1] = t
                break
        #thing = top_ten[0]
        #if t[1] > thing[1]:
            #top_ten[0] = t
    return top_ten
            
        
        





if __name__ == '__main__':
  main()
